package com.xianrenit.xianrenpuzi.manager.controller;

import com.xianrenit.xianrenpuzi.manager.service.SysRoleMenuService;
import com.xianrenit.xianrenpuzi.model.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/system/roleMenu")
@Tag(name = "角色菜单管理模块")
public class SysRoleMenuController {
    @Resource
    SysRoleMenuService sysRoleMenuService;
    @Operation(summary = "给角色分配菜单")
    @PutMapping("assignMenus2Role/{roleId}")
    //@RequestBody ，前端需要使用请求体提交([1,2,3])  axios  data:[1,2,3]
    //@RequestParam ,前端需要请求参数提交 url?menuIds=1,2,3   axios  params:[1,2,3]
    public Result assignMenus2Role(@RequestBody List<Long> menuIds,
                                   @PathVariable("roleId")Long roleId){
        sysRoleMenuService.assignMenus2Role(menuIds , roleId);
        return Result.ok();
    }
}
